package com.ship.system.api;

import com.ship.common.core.constant.ServiceNameConstants;
import com.ship.system.api.domain.dispatch.ShipInfoUpdateDto;
import com.ship.system.api.domain.dispatch.SimpleShipInfoVo;
import com.ship.system.api.factory.RemoteDispatchFallbackFactory;
import org.springframework.cloud.openfeign.FeignClient;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.RequestBody;
import org.springframework.web.bind.annotation.RequestParam;

import java.util.List;

/**
 * 通用远程调用
 * 
 * @author zhangyh
 */
@FeignClient(contextId = "remoteDispatchService", value = ServiceNameConstants.DISPATCH_SERVICE
        , fallbackFactory = RemoteDispatchFallbackFactory.class)
public interface RemoteDispatchService
{
    /**
     * 获取船只船旗国
     */
    @GetMapping(value = "/dispatchFeign/getShioCounty")
    String getShioCounty(@RequestParam(value = "shipName") String shipName, @RequestParam(value = "imo")  String imo);

    /**
     * 船员上下船状态校验
     */
    @GetMapping(value = "/dispatchFeign/checkShipCrewStatus")
    void checkShipCrewStatus();

    /**
     * 首页大屏数据缓存更新
     */
    @GetMapping(value = "/dispatchFeign/homeStatisticsCacheUpdate")
    void homeStatisticsCacheUpdate();

    /**
     * 数据看板缓存更新
     */
    @GetMapping(value = "/dispatchFeign/reportItemCacheUpdate")
    void reportItemCacheUpdate();

    /**
     * 船舶信息更新
     * @param dto
     * @return
     */
    @PostMapping(value = "/dispatchFeign")
    public Boolean updateShipInfo(@RequestBody ShipInfoUpdateDto dto);

    /**
     * 调度消息定时任务触发
     */
    @GetMapping(value = "/dispatchFeign/dispatchExpireMessageSend")
    void dispatchExpireMessageSend();

    /**
     * 调度消息定时任务触发
     */
    @GetMapping(value = "/dispatchFeign/portRouteRelationUpdate")
    void portRouteRelationUpdate();

    /**
     * 获取全球船舶信息
     */
    @GetMapping(value = "/dispatchFeign/getAllSimpleShipList")
    List<SimpleShipInfoVo> getAllSimpleShipList();

    /**
     * 调度信息更新
     * @param dto
     * @return
     */
    @PostMapping(value = "/dispatchFeign/updateDispatchInfo")
    void updateDispatchInfo(@RequestBody ShipInfoUpdateDto dto);

    /**
     * 保存当前可用船只
     */
    @GetMapping(value = "/dispatchFeign/setShipImo")
    void setShipImo();

    @GetMapping(value = "/dispatchFeign/setImoStatus")
    void setImoStatus();
}
